#include "sObjectLabel.h"
#include "sCILabel.h"
#include "sGUI.h"

namespace sgui
{
namespace res
{
    const std::wstring sObjectLabel::OBJECT_CLASS = L"OBJTEXT";

	inst::sComponentInstance* sObjectLabel::getInstance(sGUI& gui, inst::sComponentInstance* parent)
	{
        inst::sComponentInstanceLabel* inst = dynamic_cast<inst::sComponentInstanceLabel*>(sComponentObject::getInstance(gui, parent));
        if (inst)
        {
            inst->setText(getText());
        }
        return inst;
	}


    void sObjectLabel::load(db::Record &file)
    {
        sComponentObject::load(file);
    }

    void sObjectLabel::save(db::Record &file) const
    {
        sComponentObject::save(file);
    }

    void sObjectLabel::clear()
    {
        sComponentObject::clear();
    }

#ifdef _EDITOR
	void sObjectLabel::exportRTTI(rtti::sInfoList& list)
    {
		REGISTER_RTTI(L"Text", TEXT, NEW_RTTI_PARAMETER(
			STRING, sObjectLabel, this, &sObjectLabel::setText, &sObjectLabel::getText
		));
    }
#endif
	
	sObjectLabel::sObjectLabel(sGUI& gui, const std::wstring& name) :
		sComponentObject(gui, name)
    {

    }
};
};